package com.binvshe.binvshe.organization;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.binvshe.binvshe.R;
import com.binvshe.binvshe.account.utils.FragmentUtils;
import com.binvshe.binvshe.mine.corporation.CreatCorpActivity;
import com.pachong.android.baseuicomponent.activity.BaseActivity;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * Created by Zoi.
 * E-mail：KyluZoi@gmail.com
 * 2016/9/9
 */
public class JoinOrgActivity extends BaseActivity {

    @Bind(R.id.btnSearch)
    Button btnSearch;

    public static void start(Context context) {
        Intent starter = new Intent(context, JoinOrgActivity.class);
        context.startActivity(starter);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initTitle();
        initView();
    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.act_org_join, container, false);
        return view;
    }

    private void initTitle() {
        setTitle(R.string.joinOrg);
        enableBackButton();
        getCustomToolbar().addRightButton(getString(R.string.addOrg), new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CreatCorpActivity.start(JoinOrgActivity.this);
            }
        });
    }

    private void initView() {
        FragmentUtils.replaceFragment(getSupportFragmentManager(), R.id.frlytOrgList, OrgListFragment.newInstance());
    }

    @OnClick(R.id.btnSearch)
    public void onClick() {
        SearchClubActivity.start(this);
    }
}
